<template>
	<view class="bottom-view">
		<view class="child">

			<button class="button phone" open-type="getPhoneNumber" @getphonenumber="onGetphonenumber">
				<text class="wechat-text">微信登录</text>
			</button>


		</view>
	</view>
</template>

<script setup>
import { loginByWeixin } from "@/api/loginApi"
const onGetphonenumber = async (ev) => {
	const param = ev.detail;
	console.log("param:",param)
	if (!param) {
		// uni.showToast({ title: '', icon: 'none' });
		return;
	}
	// 发起请求将code、encryptedData、iv发送至后端
	const res = await loginByWeixin(param)
	console.log("wechat res:",res);
	getApp().loginByWeixin = res;

}
</script>

<style scoped lang="less">
.bottom-view {
	width: 100%;
	padding: 30rpx;
	position: fixed;
	bottom: 35px;
	box-sizing: border-box;
	text-align: center;

	.child {
		display: flex;
		flex-direction: row;

		.button {
			width: 100%;
			background-color: #28c445;
		}

		.icon-weixin1 {
			font-size: 40rpx;
			display: block;
			color: #fff;
			display: inline-block;
		}

		.wechat-text {
			font-size: 30rpx;
			display: inline-block;
			margin-left: 6px;
			color: #fff;
		}
	}
}
</style>